<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Cache;
use think\Config;

/**
 * 提示信息接口
 */
class Tips extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('i18n:62');
    }

    public function getLuckLevel(){

        if (Cache::has('site.lucklevel')){
            $data = Cache::get('site.lucklevel');
        }else{
            $data = Config::get('site.lucklevel');
            Cache::set('site.lucklevel',$data,'60');
        }

        $this->success('i18n:62',['tips'=>$data]);
    }

    public function getCooperate(){

        if (Cache::has('site.Cooperate')){
            $data = Cache::get('site.Cooperate');
        }else{
            $data = [
                'phone' => Config::get('site.phone'),
                'wechat' => Config::get('site.wechat'),
                'wechatcode' => getRealUrl(Config::get('site.wechatcode')),
            ];
            Cache::set('site.Cooperate',$data,'60');
        }

        $this->success('i18n:62',$data);
    }
}
